package com.zzx.boot.controller;

import com.zzx.boot.entity.dto.AddFeedbackDto;
import com.zzx.boot.servlet.FeedbackService;
import com.zzx.boot.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author tan
 * @version 1.0
 * @date 2023/7/11 14:40
 */
@RestController
@Api(tags = "客服模块")
@RequestMapping("/feedback")
public class FeedbackController {

    @Resource
    private FeedbackService feedbackService;

    @ApiOperation("用户反馈")
    @PostMapping("/add/{toId}")
    public R addFeedback(@Valid @RequestBody AddFeedbackDto addFeedbackDto){
        return R.success(feedbackService.addFeedback(addFeedbackDto.getToId(),addFeedbackDto.getData()));
    }

    @ApiOperation("获取用户反馈")
    @GetMapping("/get/{toId}/page/{current}")
    public R getFeedback(@PathVariable("toId")Long toId,@PathVariable("current")Long current){
        return R.success(feedbackService.getFeedback(toId,current));
    }

}
